package hello.app.model.data;
import java.io.Serializable;

public class HelloContact implements Serializable{
	 /**
	 *
	 */
	private static final long serialVersionUID = 1L;

	// テーブル名
    public static final String TABLE_NAME = "hello_contact";

    // カラム名
    public static final String ID = "id";
    public static final String NAME = "name";
    public static final String PHONE = "phone";
    public static final String GOOD = "good";
    public static final String BAD = "bad";
    public static final String ADDRESS = "address";
    public static final String TYPE = "type";
    public static final String EVALUATED = "evaluated";
    public static final int NON_EVALUATATION = 0;
    public static final int GOOD_EVALUATATION = 1;
    public static final int BAD_EVALUATATION = 2;

    private long id = 0L;
    private String name = "";
    private String phone = "";
    private String type = "";
    private String address = "";
    private int good = 0;
    private int bad = 0;
    private int evaluated = 0;
    private Comment[] comments = null;

    public HelloContact(long id, String name, String phone, int good, int bad, int evaluated, String type, String address){
    	this.id = id;
    	this.name = name;
    	this.setPhone(phone);
    	this.setGood(good);
    	this.setBad(bad);
    	this.setEvaluated(evaluated);
    	this.type = type;
    	this.address = address;
    }

    public HelloContact(long id){
    	this.id = id;
    }

	public int getEvaluated() {
		return evaluated;
	}

	public void changeEvaluated(){
		if(evaluated == GOOD_EVALUATATION){
			evaluated = BAD_EVALUATATION;
		}else if(evaluated == BAD_EVALUATATION){
			evaluated = GOOD_EVALUATATION;
		}
	}
	public String getEvaluatedString(){
		String str;
		switch(evaluated){
		case NON_EVALUATATION:
			str = "無評価";
			break;
		case GOOD_EVALUATATION:
			str = "高評価";
			break;
		case BAD_EVALUATATION:
			str = "低評価";
			break;
		default:
			str = "無評価";
			break;
		}
		return str;
	}

	public Comment[] getComments(){
		return comments == null ? new Comment[0] : comments;
	}

	public void setComments(Comment[] comments){
		this.comments = comments;
	}

	public void setEvaluated(int evaluated) {
		this.evaluated = evaluated;
	}

	public int getBad() {
		return bad;
	}

	public void setBad(int bad) {
		this.bad = bad;
	}

	public int getGood() {
		return good;
	}

	public void setGood(int good) {
		this.good = good;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getNumber() {
		return phone;
	}

	public void setNumber(String phone) {
		this.phone = phone;
	}

	public int getId() {
		return (int)id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getTypeName() {
		return type;
	}

	public void setTypeName(String type) {
		this.type = type;
	}
}
